package com.hyc.myvideo.widget;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.View;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.hyc.myvideo.R;

/**
 * 提示框  温馨提示
 * Created by dfeads on 2017/7/31.
 */

public class VIPsDialog extends Dialog {
  private OnVIPsListener onVIPsListener;

  public void setOnVIPsListener(OnVIPsListener onVIPsListener) {
    this.onVIPsListener = onVIPsListener;
  }

  public VIPsDialog(@NonNull Context context) {
    this(context, R.style.myDialogStytle);
  }

  public VIPsDialog(@NonNull Context context, @StyleRes int themeResId) {
    super(context, themeResId);
    init(context);
  }

  private void init(Context context) {
    View view = View.inflate(context, R.layout.dialog_vips, null);
    ButterKnife.bind(this,view);
    setContentView(view);
  }

  @OnClick({ R.id.dialog_vips_cancel, R.id.dialog_vips_confirm })
  public void onViewClicked(View view) {
    switch (view.getId()) {
      case R.id.dialog_vips_cancel:
        dismiss();
        break;
      case R.id.dialog_vips_confirm:
        if (onVIPsListener!=null){
          onVIPsListener.toSure(0);
        }
        dismiss();
        break;
    }
  }

  public interface OnVIPsListener{
    void toSure(int type);
  }
}
